package com.haople.sso.core.util;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Created by Administrator on 2015/12/15.
 */
public class Md5 {
    public static String md5(String str){
        String md5=null;
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] bytes=md.digest(str.getBytes("utf-8"));
            md5=ByteUtil.bytes2HexString(bytes);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }catch (UnsupportedEncodingException e){
            e.fillInStackTrace();
        }
        return md5;
    }

}

